<?php

namespace app\common\enums;

class AppointmentIntervalEnum extends BaseEnum
{
    // 定义常量
    public const ONE_0 = '1';
    public const ONE_30 = '2';
    public const DAY = '3';
    public const DAY_1 = '4';
    public const DAY_2 = '5';
    public const DAY_3 = '6';
    public const DAY_4 = '7';
    public const DAY_5 = '8';
    public const DAY_7 = '9';

    // 定义描述
    public array $description = [
        self::ONE_0 => '同一天（间隔0分钟）',
        self::ONE_30 => '同一天（间隔30分钟）',
        self::DAY => '每天',
        self::DAY_1 => '间隔1天',
        self::DAY_2 => '间隔2天',
        self::DAY_3 => '间隔3天',
        self::DAY_4 => '间隔4天',
        self::DAY_5 => '间隔5天',
        self::DAY_7 => '间隔一周',
    ];

    public array $minutes = [
        self::ONE_0 => 0,
        self::ONE_30 => 30,
        self::DAY => 60 * 24,
        self::DAY_1 => 60 * 24 * 2,
        self::DAY_2 => 60 * 24 * 3,
        self::DAY_3 => 60 * 24 * 4,
        self::DAY_4 => 60 * 24 * 5,
        self::DAY_5 => 60 * 24 * 6,
        self::DAY_7 => 60 * 24 * 7,
    ];

    public function getMinutes($value)
    {
        return $this->minutes[$value] ?? null;
    }
}
